{% extends "wiki/article.html" %}
{% load wiki_tags i18n humanize %}


{% block wiki_pagetitle %}{% trans "History of" %} "{{ attachment.current_revision.get_filename }}"{% endblock %}

{% block wiki_contents_tab %}

<h2>{% trans "History of" %} "{{ attachment.current_revision.get_filename }}"</h2>
<table class="table table-striped table-bordered">
  <tr>
    <th>{% trans "Date" %}</th>
    <th>{% trans "User" %}</th>
    <th>{% trans "Description" %}</th>
    <th>{% trans "File" %}</th>
    <th>{% trans "Size" %}</th>
    <th style="text-align: right">{% trans "Action" %}</th>
  </tr>
{% for revision in revisions %}
  <tr>
    <td>
      {{ revision.created }}
      {% if revision.deleted %}<span class="badge badge-important">{% trans "deleted" %}</span>{% endif %}
    </td>
    <td>
      {% include "wiki/includes/revision_info.html" with revision=attachment.current_revision hidedate=1 hidenumber=1 %}
    </td>
    <td>{{ revision.description|default:_("<em>No description</em>")|safe }}</td>
    <td>{{ revision.get_filename }}</td>
    <td>{{ revision.get_size|filesizeformat }}</td>
    <td style="text-align: right">
      <form method="POST" action="{% url 'wiki:attachments_revision_change' path=urlpath.path article_id=article.id attachment_id=attachment.id revision_id=revision.id %}">
        {% csrf_token %}
        <a href="{% url 'wiki:attachments_download' path=urlpath.path article_id=article.id attachment_id=attachment.id revision_id=revision.id %}" class="btn btn-primary">
          <span class="fa fa-download"></span>
          {% trans "Download" %}
        </a>
        {% if revision.attachment.article|can_write:user %}
            <button{% if revision == attachment.current_revision %} disabled="disabled"{% endif %} class="btn btn-default">
              <span class="fa fa-flag"></span>
            {% trans "Use this!" %}
            </button>
        {% endif %}
      </form>
    </td>
  </tr>
{% endfor %}
</table>
<a href="{% url 'wiki:attachments_index' path=urlpath.path article_id=article.id %}"><span class="fa fa-arrow-left"></span> {% trans "Go back" %}</a>

{% endblock %}
